<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<script type="text/javascript" src="${pageContext.request.contextPath}/static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript"
        src="${pageContext.request.contextPath}/static/easyui/jquery.easyui.validate.js"></script>
<script type="text/javascript"
        src="${pageContext.request.contextPath}/static/easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/easyui/easyui.treex.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/easyui/easyui.treex.search.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/easyui/easyui.datagridx.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/easyui/datagrid-bufferview.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/msgbox/msgbox.js"></script>

<script type="text/javascript">
    $(function () {
        //只防止input和textarea 浏览器中Backspace仍可用
        $(document).keydown(function (e) {
            var keyEvent;
            if (e.keyCode == 8) {
                var d = e.srcElement || e.target;
                if (d.tagName.toUpperCase() == 'INPUT' || d.tagName.toUpperCase() == 'TEXTAREA') {
                    keyEvent = d.readOnly || d.disabled;
                }
            } else {
                keyEvent = false;
            }
            if (keyEvent) {
                e.preventDefault();
            }
        });
        $.ajaxSetup({
            //完成请求后触发。即在success或error触发后触发
            complete: function (XMLHttpRequest, textStatus) {
                //后台如果传回了null或者""也会报parsererror错误
                if (textStatus == "parsererror" && XMLHttpRequest.responseText != "") {
                    $.messager.alert('提示', "登陆超时！请重新登陆！", 'info', function () {
                        window.location.href = '${pageContext.request.contextPath}/login';
                    });
                    $('.panel-tool-close').hide();
                } else if (textStatus == "error") {
                    if (XMLHttpRequest.status == 302) {
                        $.messager.alert('提示', "对不起，您没有该权限！", 'error');
                    } else if (XMLHttpRequest.status == 404) {
                        $.messager.alert('提示', "对不起，没有找到该资源！", 'error');
                    } else {
                        $.messager.alert('提示', "服务器异常！请稍后再试！", 'error');
                    }
                }
            }
        })
    })
</script>